package com.qf.map;


import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class DBUtils {
	private static String ip;
	private static String port;

	static {

		// InputStream in = new FileInputStream("E:\\Desktop\\testProperties.txt");

		InputStream in = DBUtils.class.getClassLoader().getResourceAsStream("db_properties");
		// 要求键值都必须是String类型<String,String>
		Properties p = new Properties();

		// 读取文件数据，到p的映射里
		try {
			p.load(in);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		ip = p.getProperty("ip");
		port = p.getProperty("port");
		// System.out.println(p.getProperty("ip"));

	}

	public static void getConnection() {

		System.out.println("ip:" + ip);
		System.out.println("port:" + port);

	}

}
